exports.getApplicationContainerDetail = function(req,res){

    var restfulParams = req.routeInfo.restfulParams;

    var containerData = [];

    //获取该应用下的所有容器
    function getApplicationContainer(cb){

        R.SEND_HTTP(
            req,
            res,
            {
                url    : CORE_APIConfig.coreAPI.easydCloudMemberApplicationContainerSearch.Request_Api_Url + "/cmac_cmaid/"+restfulParams.appid+"/skip/0/limit/999/ cmac_is_delete/0/sort_order/cmac_type-asc",  
                method : 'POST'
            },
            function (data) {

                containerData = data.result.data;
                
                cb();

            }
        )
    }

    //分别查询每个容器的状态
    function getContainerStatus(cb){

        F.SerialEach(containerData,function(item,index,callback){

            //查询状态
            var containerName = item.cmac_name;
            R.Ssh_exec_dockerCommand(`${DockerSH.GetContainerStatus} ${containerName}`,function(rs){
                if(rs.indexOf('running') != -1){
                    item.serverStatus = 1;
                }else{
                    item.serverStatus = 0;
                }
                callback();
            })
          
        },cb)


    }

    F.Serial([
        getApplicationContainer,
        getContainerStatus
    ],() => {
        RES.successResponse(res,containerData);
    })

}